package com.wwm.springcloud.userservice.controller;

import com.wwm.springcloud.userservice.bean.PortalUser;
import com.wwm.springcloud.userservice.service.PortalUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class UserController extends BaseController
{
    @Autowired
    private PortalUserService userService;

    @Value("${test}")
    private String test;

    /**
     * 发票查询
     * @throws Exception
     */
    @PostMapping(value = "/user/findUserByName",produces = JSON_CONTENT_TYPE)
    public PortalUser findUserByName(@RequestParam String username) throws Exception
    {
        PortalUser user = userService.findUserByName(username);
        return user;
    }

    /**
     * 测试
     * @throws Exception
     */
    @RequestMapping(value = "/test")
    public String test() throws Exception
    {
        return test;
    }
}
